<?php

error_reporting(E_ALL);
ini_set('display_errors', 'On');
class Connection {

    private static $conexao = null;
   /* const DATABASE_NAME = " dbname=DSA";
    const HOST = "host=localhost";
    const PORT = " port=5433";
    const USER = " user=postgres";
    const PASS = " password=banco";*/
    
    const DATABASE_NAME = "dsa";
    const HOST = "localhost";
    const USER = "root";
    const PASS = "";

    private function __construct() {
        
       // self::$conexao = pg_connect(self::HOST . self::PORT . self::DATABASE_NAME . self::USER . self::PASS);
        self::$conexao = new mysqli(self::HOST, self::USER, self::PASS, self::DATABASE_NAME);
       //var_dump (self::$conexao); die;
    }
    /**
     *
     * @return mysqli
     */
    public static function getConnection() {
        if (self::$conexao == null) {
            new Connection();
        }
        return self::$conexao;
    }
    
}

//$conn = Connection::getConnection();

//$rs = $conn->prepare("SELECT uf, descricao FROM estado");

//$rs->execute();
//$rs->bind_result($uf, $descricao);
//$estado = new Estado();
//$estados = array();
//while($linha = $rs->fetch()){
//    echo $uf."<br />";
//    echo $descricao;
//}
//die;
//var_dump($estados);
?>
